package com.spring.boot.job;

import com.spring.boot.annotation.JobNameAnnotation;
import com.spring.boot.annotation.TriggerNameAnnotation;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MarkerFactory;

import java.util.Date;

/**
 * @program: springboot_vue
 * @description: 测试job
 * @author: ry
 * @create: 2018-08-16 16:37
 **/
@JobNameAnnotation("HelloJob")
@TriggerNameAnnotation("HelloTrigger")
@DisallowConcurrentExecution//并发执行
public class HelloJob implements BaseJob{
    private static Logger _log = LoggerFactory.getLogger(HelloJob.class);

    public void execute(JobExecutionContext context) throws JobExecutionException {
        try {
            _log.info(MarkerFactory.getMarker("info测试"),"infor日志");
            _log.error(MarkerFactory.getMarker("infor测试"), "error日志");
            System.out.println("进入job任务");
        } catch (Exception e) {
            e.printStackTrace();
        }
        _log.error("Hello Job执行时间: " + new Date());

    }
}
